from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QApplication,QWidget,QFormLayout
from PyQt5.QtWidgets import QPushButton,QLineEdit
import sys


def on_submit():
    print("用户名:",edit_user.text())
    print("密码:",edit_pwd.text())
    print("手机号:",edit_phone.text())  
    
    #给按钮添加/关联点击事件（函数）
if __name__ == '__main__':

    
    # 创建应用程序
    app = QApplication(sys.argv)
    
    # 创建窗口

    w = QWidget()
    #设置窗口标题
    w.setWindowTitle("按钮")
        #  创建水平布局 HorizontalLayout    垂直布局 VerticalLayout
    layout = QFormLayout()
    w.setLayout(layout) 
    edit_user = QLineEdit()
    edit_pwd = QLineEdit()
    edit_pwd.setEchoMode(QLineEdit.Password)
    edit_phone = QLineEdit()
    #提交按钮
    btn = QPushButton("提交")
    #给按钮添加/关联点击事件（函数）
    btn.clicked.connect(on_submit)
    layout.addRow("用户名",edit_user)
    layout.addRow("密码",edit_pwd)
    layout.addRow("手机号",edit_phone)
    layout.addRow(btn)  
 
    

    #显示窗口
    #提交  
    w.show()

    #等待窗口停止
    sys.exit(app.exec())